import 'package:flutter/material.dart';
import 'package:ivc/views/lending/lending_order_list.dart';
import 'package:ivc/views/parts/parts_order_list.dart';
import '../../model/bizmodel.dart';
import "../../model/test_data.dart";
import "../../routers/application.dart";
import '../mr/mr_order_list.dart';
import '../mr/mr_request_page.dart';
import '../mr/mr_history_page.dart';
import '../assets/asset_info_page.dart';
import '../b2b/put_sell.dart';

class AssetPage extends StatefulWidget {
  final String category;
  final String id;
  final int tab;
  AssetPage({Key key, this.id, this.tab: 0, this.category}) : super(key: key);

  @override
  _AssetPageState createState() => _AssetPageState();
}

class _AssetPageState extends State<AssetPage> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: DefaultTabController(
        length: 4,
        initialIndex: this.widget.tab,
        child: Scaffold(
          appBar: AppBar(
            bottom: TabBar(
              tabs: [
                Tab(icon: Icon(Icons.build), text: '发起维修'), //Tmall
                Tab(icon: Icon(Icons.history), text: '维修记录'), //Alipay
                Tab(icon: Icon(Icons.info), text: '设备信息'), //到家
                Tab(icon: Icon(Icons.compare_arrows), text: '二手售出'), //转转
              ],
            ),
            title: Text("SY65W轮胎式液压挖掘机"),
            actions: <Widget>[
              IconButton(
                icon: Icon(Icons.fullscreen),
                onPressed: () async {
                  Application.router.navigateTo(context, "/scanner");
                },
              ),
            ],
          ),
          body: TabBarView(
            children: [
              MRRequestPage(id:this.widget.id),
              MRHistoryPage(id:this.widget.id),
              AssetInfoPage(id:this.widget.id),
              PutSellPage(id:this.widget.id),
              /*MRHistoryPage(id:this.widget.id),
              AssetInfoPage(id:this.widget.id),
              PutSellPage(id:this.widget.id),*/
            ],
          ),
        ),
      ),
    );
  }
}
